<?php
class IndexController extends Zend_Controller_Action {
	public function preDispatch() { 
		$auth = Zend_Auth::getInstance(); 
		if (!$auth->hasIdentity()) { 
			$this->_forward('login', 'login'); 
		}
		else {
			if(!NerdPass_Acl::isAllowed($auth->getIdentity(), 'passwords')) {
				$this->_forward('denied', 'error');
			}
			
		}
	} 
	
	public function indexAction() {
		$this->view->categories = NerdPass_Data::getCategories();
		$this->view->passwords = NerdPass_Data::getPasswords();
	}
}